package com.qoq.test.chapter2;

/**
 * VM参数：-Xss128k
 * 栈溢出测试
 */
public class JavaVMStackSOF1 {
    private int stackLength = 1;
    public void stackLeak() {
        stackLength++;
        stackLeak();
    }

    public static void main(String[] args) {
        JavaVMStackSOF1 stackSOF = new JavaVMStackSOF1();
        try {
            stackSOF.stackLeak();
        } catch (Throwable throwable) {
            System.out.println("stack length: " + stackSOF.stackLength);
            throw throwable;
        }
    }
}
